import Taro, { Component } from '@tarojs/taro';
import { View } from '@tarojs/components'
import './searchlist.scss'

class searchlist extends Component {
 
  goDetail(item){
    let id = item.id
    console.log(id)
    Taro.navigateTo({
      url: '/pages/detail/detail?id='+id,
    })
  }


  render() {
    return (
      <View class="list-container" >
        {
          this.props.datalist&&this.props.datalist.map((item) => {
            return (
              <View class="item" data-id={item.id} onClick={()=>this.goDetail(item)} key={item.id} >
                <View class="title">
                  {item.address} 
                 {item.type === 'buy' ? '求购' : '转让'}
                </View>
                <View class="desc">{item.message}</View>
              </View>
            )
          })
        }
      </View>
    );
  }
}

export default searchlist;